<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .red {
            background: red;
        }

        .blue {
            background: blue;
        }
    </style>
</head>

<body>
    <button id="btn1" data-show-ype="show">btn1</button>
    <button id="btn2" data-show-type="goodShow">btn2</button>
    <script>
        btn1.addEventListener("click", toggleClass.bind(btn1, "red",'1')) //会直接执行 那就返回一个函数
        btn2.addEventListener("click", toggleClass.bind(btn2, "blue",'2'))

        function toggleClass(className,num, ev) {
            //ev是怎么传进来的？？？
            // 柯里化了
            // console.log(this.getAttribute)
            console.dir(this)
            console.log(num)
            console.log(this.getAttribute("data-show-ype"))
            console.log(ev)
            this.classList.toggle(className)


        }
    </script>
</body>

</html>